﻿namespace Settings.NET.UnitTests.Helpers
{
    using System.Collections.Generic;

    internal class KeyScopeComparer : IEqualityComparer<KeyScope>
    {
        public bool Equals(KeyScope x, KeyScope y)
        {
            if (ReferenceEquals(x, y))
            {
                return true;
            }
            
            if (x == null || y == null)
            {
                return false;
            }

            return x.Key == y.Key && x.Scope == y.Scope;
        }

        public int GetHashCode(KeyScope obj)
        {
            return new { obj.Key, obj.Scope }.GetHashCode();
        }
    }
}